import React, { Component } from 'react';

class App extends Component {
    myref = React.createRef()
    render() {
        return (
            <div onClick={e => this.btnHandle()}>
                <div ref='mytxt'>
                    我是第一个ref
                </div>
                <div ref={this.myref}>
                    我是第二个ref
                </div>
                App
            </div>
        );
    }
    btnHandle(){
        console.log('我是事件点击',this.refs.mytxt);
        console.log('我是第二个ref',this.myref.current);
    }
}

export default App;
